<md-dialog aria-label="" ng-cloak flex="85">
    <form name="ReferralDetailsForm" ng-cloak>
        <md-toolbar>
            <div class="md-toolbar-tools">
                <h2>Referral Details</h2>
                <span flex></span>
                <md-button aria-label="Close" class="md-icon-button" ng-click="vm.CloseDialog(ReferralDetailsForm.$dirty)">
                    <md-tooltip>Close</md-tooltip>
                    <md-icon md-font-library="material-icons">&#xE5CD;</md-icon>
                </md-button>
            </div>
        </md-toolbar>
        <md-dialog-content layout="column" layout-align="space-around stretch">
            <div layout="column" layout-gt-xs="row" layout-align="space-around stretch" layout-align-gt-xs="space-around center">
                <div flex layout-padding>
                    <md-input-container class="md-icon-float md-block md-accent inputValidation">
                        <label>Referring Physisican</label>

                        <md-select ng-model="vm.ReferringPhysician" required name="ReferringPhysician" ng-disabled="true">
                            <md-option ng-repeat="Py in vm.PhysicianList" value="{{Py.PhysicianID}}">
                                {{Py.PhysicianFullName}}
                            </md-option>
                        </md-select>
                        <div ng-messages="ReferralDetailsForm.ReferringPhysician.$error" role="alert">
                            <div ng-message-exp="['required']">
                                Referring Physician cannot be blank
                            </div>
                        </div>
                    </md-input-container>
                </div>
                <div flex layout-padding>
                    <md-input-container class="md-icon-float md-block md-accent inputValidation">
                        <label>Referring Physician Practice</label>

                        <md-select ng-model="vm.ReferringPhysicianPractice" required name="ReferringPhysicianPractice" ng-disabled="true">
                            <md-option ng-repeat="Pr in vm.PracticeList" value="{{Pr.PracticeID}}">
                                {{Pr.PracticeName}}
                            </md-option>
                        </md-select>
                        <div ng-messages="ReferralDetailsForm.ReferringPhysicianPractice.$error" role="alert">
                            <div ng-message-exp="['required']">
                                Referring Physician Practice cannot be blank
                            </div>
                        </div>
                    </md-input-container>
                </div>
            </div>
            <div layout="column" layout-gt-xs="row" layout-align="space-around stretch" layout-align-gt-xs="space-around center">
                <div flex layout-padding>
                    <md-input-container class="md-icon-float md-block md-accent inputValidation">
                        <label>Physisican Fax#</label>
                        <input class="StyledTextInput" ng-model="vm.PhysicianFax" name="PhysicianFax">
                        <div ng-messages="ReferralDetailsForm.PhysicianFax.$error" role="alert">
                        </div>
                    </md-input-container>
                </div>

                <div flex layout-padding layout="row" style="min-height:45px;">
                    <md-input-container class="md-icon-float md-block md-accent inputValidation">
                        <label>Physician E-mail</label>
                        <input class="StyledTextInput" ng-model="vm.Email" name="Email" type="email" ng-pattern="/^.+@.+\..+$/" >
                        <div ng-messages="PatientDetailsForm.Email.$error" role="alert">
                            <div ng-message-exp="['pattern']">
                                Enter a valid email
                            </div>
                        </div>
                    </md-input-container>
                </div>
            </div>

            <div layout="column" layout-gt-xs="row" layout-align="space-around stretch" layout-align-gt-xs="space-around center">
                <div flex layout-padding>
                    <md-input-container class="md-icon-float md-block md-accent inputValidation">
                        <label>Requested Practice</label>

                        <md-select ng-model="vm.RequestedPractice" required name="RequestedPractice">
                            <md-option ng-repeat="Pr in vm.PracticeList" value="{{Pr.PracticeID}}">
                                {{Pr.PracticeName}}
                            </md-option>
                        </md-select>
                        <div ng-messages="ReferralDetailsForm.RequestedPractice.$error" role="alert">
                            <div ng-message-exp="['required']">
                                Requested Practice cannot be blank
                            </div>
                        </div>
                    </md-input-container>
                </div>

                <div flex layout-padding>
                    <md-input-container class="md-icon-float md-block md-accent inputValidation">
                        <label>Assigned Physisican</label>

                        <md-select ng-model="vm.AssignedPhysician" name="AssignedPhysician" ng-disabled="true">
                            <md-option ng-repeat="Py in vm.PhysicianList" value="{{Py.PhysicianID}}">
                                {{Py.PhysicianFullName}}
                            </md-option>
                        </md-select>
                        <div ng-messages="ReferralDetailsForm.AssignedPhysician.$error" role="alert">
                        </div>
                    </md-input-container>
                </div>
            </div>

            <div layout="column" layout-gt-xs="row" layout-align="space-around stretch" layout-align-gt-xs="space-around center">
                <div flex layout-padding>
                    <md-input-container class="md-icon-float md-block md-accent inputValidation">
                        <label>Reason for referral</label>
                        <textarea class="StyledTextInput" ng-model="vm.ReferralReason" name="ReferralReason" rows="3" md-maxlength="1000"></textarea>
                        <div ng-messages="ReferralDetailsForm.ReferralReason.$error" multiple md-auto-hide="false" role="alert">
                            <div ng-message-exp="['maxlength']">
                                The reason for referral should be less than 1000 characters long
                            </div>
                        </div>
                    </md-input-container>
                </div>
            </div>

            <div layout="column" layout-gt-xs="row" layout-align="space-around stretch" layout-align-gt-xs="space-around center">
                <div flex layout-padding>
                    <md-input-container class="md-icon-float md-block md-accent inputValidation">
                        <label>Referral Notes</label>
                        <textarea class="StyledTextInput" ng-model="vm.ReferralNotes" name="ReferralNotes" rows="5" md-maxlength="5000"></textarea>
                        <div ng-messages="ReferralDetailsForm.ReferralNotes.$error" multiple md-auto-hide="false" role="alert">
                            <div ng-message-exp="['maxlength']">
                                The reason for referral should be less than 5000 characters long
                            </div>
                        </div>
                    </md-input-container>
                </div>
            </div>
        </md-dialog-content>
        <md-dialog-actions layout="row">
            <md-button type="reset" class="md-raised md-hue-2 md-primary" ng-click="vm.CloseDialog(ReferralDetailsForm.$dirty)">Cancel</md-button>
            <md-button type="reset" class="md-raised md-hue-3 md-accent" ng-click="vm.SaveReferralDetails()">Save</md-button>
            <!--<md-button type="submit" class="md-raised md-hue-3 md-accent" ng-click="vm.SaveReferralDetails()" ng-disabled="ReferralDetailsForm.$pristine || ReferralDetailsForm.$invalid">Save</md-button>-->
        </md-dialog-actions>
    </form>
</md-dialog>